<?php

use think\Facade\Route;
use think\Facade\Env;

Route::domain(Env::get('app.api_url'), function () {

    header("Access-Control-Allow-Origin: *");
    header('Access-Control-Allow-Methods: POST, PUT, GET, OPTIONS, DELETE, HEAD, PATCH');
    header("Access-Control-Allow-Headers: token,language, Origin, X-Requested-With, Content-Type, Accept");
    Route::miss(function () {
        echo '无访问权限';
        exit();
    });

    Route::group('User', function () {
        Route::post('Register', '/Register'); //用户注册
        Route::post('Login', '/Login'); //用户登录
        Route::post('Forget', '/Forget'); //忘记密码
        Route::post('TradeEdit', '/TradeEdit'); //修改登录、交易密码
        Route::rule('UserAuth', '/UserAuth'); //身份认证
        Route::rule('UserSafety', '/UserSafety'); //添加收款方式
        Route::get('Myteam', '/Myteam'); //我的团队
        Route::post('SignLog', '/SignLog'); //我的团队
        Route::get('Info', '/Info'); //我的团队
        Route::get('attr', '/attr'); //我的团队
    })->prefix('User');

    Route::group('Other', function () {
        Route::post('sendMns', '/sendMns'); //发送短信
        Route::get('Notice', '/Notice'); //公共信息
        Route::get('Banner', '/Banner'); //轮播图
        Route::get('Customer', '/Customer'); //客服
        Route::get('Help', '/Help'); //帮助中心
        Route::rule('Message', '/Message'); //问题反馈
        Route::rule('Version', '/Version'); //版本参数等信息
        Route::rule('CoinsPrice', '/CoinsPrice'); //版本参数等信息
        Route::rule('Oss', '/Oss'); //版本参数等信息
        Route::get('Other', '/Other'); //版本参数等信息
    })->prefix('Other');

    Route::group('Minging', function () {
        Route::get('lists', '/lists'); //矿机列表
        Route::rule('give_lists', '/give_lists'); //奖励矿机和领取奖励列表
        Route::rule('buy_machine', '/buy_machine'); //奖励矿机和领取奖励列表
        Route::post('Receive', '/Receive'); //领取收益
    })->prefix('Minging');

    Route::group('Conntract', function () {
        Route::get('lists', '/lists'); //矿机列表
        Route::post('adopt', '/adopt'); //预约、抢购
        Route::get('reser', '/reser'); //预约记录
        Route::get('Mycontract', '/Mycontract'); //我的合约
        Route::get('Mycontracting', '/Mycontracting'); //我的合约
        Route::post('Cacelcontracting', '/Cacelcontracting'); //取消合约
        Route::post('Paycontract', '/Paycontract'); //付款合约
        Route::post('Endcontract', '/Endcontract'); //确认合约
        Route::post('Applycontract', '/Applycontract'); //投诉合约
        Route::get('Detailcontract', '/Detailcontract'); //投诉合约
        Route::rule('Exchange', '/Exchange'); //投诉合约
        Route::rule('haveExchange', '/haveExchange'); //投诉合约
        Route::get('info', '/info'); //投诉合约
    })->prefix('Conntract');

    Route::group('Hall', function () {
        Route::get('lists', '/lists'); //交易大厅
        Route::get('hallother', '/hallother'); //交易大厅
        Route::post('ReleOrder', '/ReleOrder'); //发布订单
        Route::get('MyOrder', '/MyOrder'); //我的交易订单
        Route::get('MyHallOrder', '/MyHallOrder'); //我的发布订单
        Route::get('OrderDetail', '/OrderDetail'); //订单详情
        Route::post('MatchOrder', '/MatchOrder'); //匹配订单
        Route::post('PayOrder', '/PayOrder'); //付款订单
        Route::post('EndOrder', '/EndOrder'); //完成订单
        Route::post('CompOrder', '/CompOrder'); //投诉订单      
        Route::post('Cacel', '/Cacel'); //投诉订单  
        Route::get('MoneyLog', '/MoneyLog'); //投诉订单
    })->prefix('Hall');
})->bind('api')->prefix('api');
